tar xf ${DOWNLOADDIR}/linux-6.16.3.tar.xz -C ${BUILDDIR}
cp -v config-loongson ${BUILDDIR}/linux-6.16.3/.config
pushd ${BUILDDIR}/linux-6.16.3
	# patch -Np1 -i ${DOWNLOADDIR}/0001-double-tty-VT-screenbuf-for-univt.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0002-Add-several-function-for-Univt.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0003-UniVT-Fix-charcount-size-to-65536.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0004-UniVT-Add-a-old_screen_size-variable-saves-the-origi.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0005-Univt-Add-support-for-writing-UTF-8-encoding.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0006-UniVT-Add-support-for-displaying-UTF-8-text.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0007-UniVT-Support-displaying-UTF-8-text-for-90-degree-ro.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0008-UniVT-Support-displaying-UTF-8-text-for-180-degree-r.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0009-UniVT-Support-displaying-UTF-8-text-for-270-degree-r.patch
	# patch -Np1 -i ${DOWNLOADDIR}/0001-UniVT-Add-Chinese-fonts-support-in-console.patch
       
	make ARCH=loongarch CROSS_COMPILE=${CROSS_TARGET}- olddefconfig
	PKG_CONFIG_SYSROOT_DIR="" \
	     make -s ARCH=loongarch CROSS_COMPILE=${CROSS_TARGET}- ${JOBS}
	PKG_CONFIG_SYSROOT_DIR="" \
	     make -s ARCH=loongarch CROSS_COMPILE=${CROSS_TARGET}- INSTALL_MOD_PATH=dest modules_install
	mkdir -pv ${SYSDIR}/sysroot/lib/modules/
	cp -a dest/lib/modules/* ${SYSDIR}/sysroot/lib/modules/
	cp -av arch/loongarch/boot/vmlinuz.efi ${SYSDIR}/sysroot/boot/vmlinuz.efi
	pushd tools/perf
	    # here JOBS reused as -j${JOBS}
	    unset JOBS
	    make ARCH=loongarch CROSS_COMPILE=${CROSS_TARGET}- NO_LIBTRACEEVENT=1
	    make ARCH=loongarch CROSS_COMPILE=${CROSS_TARGET}- \
			 NO_LIBTRACEEVENT=1 \
	                 DESTDIR=${SYSDIR}/sysroot prefix=/usr install 
	popd
popd

